#-*- coding:utf8 -*-
# 定义一个完整的异常结构

#没有异常的情况下 会在try里面代码执行完毕后还会执行else 中代码 

try:
  import os
  print "this in try"
except ImportError:
  print "excpiton, import is wrong"

else:
  print "import is ok"


print "programe is run to here"

print "exception 1"


#捕获到异常后，程序继续执行
try:
  import os2
  print "this in try"
except ImportError:
  print "excpiton, import is wrong"

else:
  print "import is ok"


print "programe is run to here"


# 异常 未捕获 ，程序将会退出并报错
try:
  import os2
  print "this in try"
except IOError:
  print "excpiton, import is wrong"
  

else:
  print "import is ok"


print "programe is run to here"


